import { getList } from '@/apis/apis';
import React, { useEffect, useState } from 'react';
import { Avatar, List } from 'antd';
import { useNavigate } from 'react-router-dom';
import { Lazyload } from 'react-vant';
function Home() {
    const [data,setData]=useState('')
    const navigate=useNavigate('')
    const aa=async()=>{
        const res=await getList({
            page:1,//页码  必传
pageSize:6,//每页显示条数 必传
keyword:null,//搜索标题
tag:null//搜索标签

        })
        // console.log(res.rows)
        setData(res.rows)
        

    }
    useEffect(()=>{
        aa()
    },[])

    const xq=(idd)=>{
        console.log(idd);
        
        navigate(`/detail/${idd}`)
    }
    return (
        <div>
            <List
    itemLayout="horizontal"
    dataSource={data}
    extra={
          <img
            width={272}
            alt="logo"
            Lazyload
            src="https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLcXyDKnZfES.png"
          />
        }
    renderItem={(item, index) => (
      <List.Item >
        <List.Item.Meta
          onClick={()=>xq(item.id)}
          title={item.title}
          description={
            <div>
                
                <span>{item.content}</span>
                <img
            style={{width:'200px',float:'right'}}
            alt="logo"
            src="https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLcXyDKnZfES.png"
          />
            </div>
          }
        />
      </List.Item>
    )}
  />
        </div>
    );
}

export default Home;